package com.xingxue.logistics.common.vo;

import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * 统一的RESTful接口返回
 * @author Kris at 2018/9/29 11:00
 */
public class RestResult<T> {
    private boolean success = false;

    private String msg;

    private T data;

    public RestResult() {
    }

    public RestResult(boolean success, String msg, T data) {
        this.success = success;
        this.msg = msg;
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, new MultilineRecursiveToStringStyle())
                .append("success", success)
                .append("msg", msg)
                .append("data", data)
                .toString();
    }
}
